<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8" isELIgnored="false"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@include file="commen/path.jsp" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>电商平台的后台管理系统</title>
		<link rel="stylesheet" href="${path}/css/main.css" />
		<script type="text/javascript" src="${path}/js/jquery-3.3.1.min.js"></script>
	</head>
	<body>
		<div id="content">
			<%@ include file="commen/head.jsp" %>
			<div class="middle">
				 <%@ include file="commen/left.jsp" %>
				  <div class="right">
				   <form action="${path}/goods/insert" method="post" enctype="multipart/form-data">
                   <table>
                     <tr>
                        <td>商品名</td>
                         <td><input type="text" name="gname"></td></tr>
                      <tr>   
                        <td>类型</td>
                        <td>
                           <select name="cid">
                             
                           </select>
                        </td>
                      </tr>
                        <tr>  
                         <td>图片</td>
                         <td>
                           <input type="file" name="imgfile" multiple="multiple">
                         </td>
                     </tr>
                     
                     <tr>
                       <td colspan="2">
                         <input type="submit" value="添加">
                       </td>
                     </tr>
                   </table>			  	  
		
				  	 </form> 
				  </div>
				  
			</div>
			<%@ include file="commen/foot.jsp" %>
			
		</div>
		
		<script>
		  //类别显示
		  $(function(){
			  $.ajax({
				  url:"${path}/cate/list",/* 请求的路径 */
				  type:"get",/*  请求的方式*/
				  dataType:"json",/* 接受的类型 */
				  success:function(result){/*通过回调函数，返回成功的结果  */
					  
					  var str=""
					  $(result).each(function(){
						
						  str+="<option value='"+this.cid+"'>"+this.cname+"</option>"
					  })
					  $("select[name='cid']").html(str);
				  }
			  })
		  })
		  
		  </script>
	</body>
</html>
